﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework;

namespace GameBase
{
    public class VisibleObject : VisibleGameEntity
    {
        protected Sprite sprite;
        
        protected float anpha = 1;

        public float Anpha
        {
            get { return sprite.Anpha; }
            set { sprite.Anpha = value; }
        }

        public Sprite Sprite
        {
            get { return sprite; }
            set { sprite = value; }
        }       

        

        public VisibleObject()
        {
        }
        public virtual Color Color
        {
            get { return sprite.Color; }
            set { sprite.Color = value; }
        }

        public VisibleObject(Texture2D texture, int row, int col)
        {
            sprite = new Sprite(texture, row, col);
        }

        public VisibleObject(string filePath,int row,int col)
        {
            sprite = new Sprite(filePath, row, col);
        }

        public VisibleObject(string filePath, int row, int col,Vector2 position)
        {
            sprite = new Sprite(filePath, row, col);
            Position = position;
        }

        public override void Update(Microsoft.Xna.Framework.GameTime gameTime)
        {
            base.Update(gameTime);
            if(sprite != null)
                sprite.Update(gameTime);
        }

        public override void Draw(Microsoft.Xna.Framework.GameTime gameTime, Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch)
        {
            base.Draw(gameTime, spriteBatch);
            if (sprite != null)
                sprite.Draw(gameTime, spriteBatch,
                    GetDrawPosition(),GetDrawRotate(),GetDrawScale(), depth);
        }
    }
}
